using System; 
using System.Text; 
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration; 
using System.Xml; 
using System.Xml.Serialization;
using SubSonic; 
using SubSonic.Utilities;

namespace Adex{
    /// <summary>
    /// Strongly-typed collection for the VPlanningLog class.
    /// </summary>
    [Serializable]
    public partial class VPlanningLogCollection : ReadOnlyList<VPlanningLog, VPlanningLogCollection>
    {        
        public VPlanningLogCollection() {}

    }

    /// <summary>
    /// This is  Read-only wrapper class for the vPlanningLog view.
    /// </summary>
    [Serializable]
    public partial class VPlanningLog : ReadOnlyRecord<VPlanningLog> 
    {
    
	    #region Default Settings
	    protected static void SetSQLProps() 
	    {
		    GetTableSchema();
	    }

	    #endregion
        #region Schema Accessor
	    public static TableSchema.Table Schema
        {
            get
            {
                if (BaseSchema == null)
                {
                    SetSQLProps();
                }

                return BaseSchema;
            }

        }

    	
        private static void GetTableSchema() 
        {
            if(!IsSchemaInitialized)
            {
                //Schema declaration
                TableSchema.Table schema = new TableSchema.Table("vPlanningLog", TableType.View, DataService.GetInstance("Adex"));
                schema.Columns = new TableSchema.TableColumnCollection();
                schema.SchemaName = "dbo";
                //columns
                
                TableSchema.TableColumn colvarMediaTypeName = new TableSchema.TableColumn(schema);
                colvarMediaTypeName.ColumnName = "MediaTypeName";
                colvarMediaTypeName.DataType = DbType.String;
                colvarMediaTypeName.MaxLength = 50;
                colvarMediaTypeName.AutoIncrement = false;
                colvarMediaTypeName.IsNullable = true;
                colvarMediaTypeName.IsPrimaryKey = false;
                colvarMediaTypeName.IsForeignKey = false;
                colvarMediaTypeName.IsReadOnly = false;
                
                schema.Columns.Add(colvarMediaTypeName);
                
                TableSchema.TableColumn colvarMediaName = new TableSchema.TableColumn(schema);
                colvarMediaName.ColumnName = "MediaName";
                colvarMediaName.DataType = DbType.String;
                colvarMediaName.MaxLength = 255;
                colvarMediaName.AutoIncrement = false;
                colvarMediaName.IsNullable = true;
                colvarMediaName.IsPrimaryKey = false;
                colvarMediaName.IsForeignKey = false;
                colvarMediaName.IsReadOnly = false;
                
                schema.Columns.Add(colvarMediaName);
                
                TableSchema.TableColumn colvarMediaType = new TableSchema.TableColumn(schema);
                colvarMediaType.ColumnName = "MediaTypeCode";
                colvarMediaType.DataType = DbType.Int32;
                colvarMediaType.MaxLength = 0;
                colvarMediaType.AutoIncrement = false;
                colvarMediaType.IsNullable = true;
                colvarMediaType.IsPrimaryKey = false;
                colvarMediaType.IsForeignKey = false;
                colvarMediaType.IsReadOnly = false;
                
                schema.Columns.Add(colvarMediaType);
                
                TableSchema.TableColumn colvarPlanningLogID = new TableSchema.TableColumn(schema);
                colvarPlanningLogID.ColumnName = "PlanningLogID";
                colvarPlanningLogID.DataType = DbType.Int32;
                colvarPlanningLogID.MaxLength = 0;
                colvarPlanningLogID.AutoIncrement = false;
                colvarPlanningLogID.IsNullable = false;
                colvarPlanningLogID.IsPrimaryKey = false;
                colvarPlanningLogID.IsForeignKey = false;
                colvarPlanningLogID.IsReadOnly = false;
                
                schema.Columns.Add(colvarPlanningLogID);
                
                TableSchema.TableColumn colvarMediaCode = new TableSchema.TableColumn(schema);
                colvarMediaCode.ColumnName = "MediaCode";
                colvarMediaCode.DataType = DbType.Int32;
                colvarMediaCode.MaxLength = 0;
                colvarMediaCode.AutoIncrement = false;
                colvarMediaCode.IsNullable = true;
                colvarMediaCode.IsPrimaryKey = false;
                colvarMediaCode.IsForeignKey = false;
                colvarMediaCode.IsReadOnly = false;
                
                schema.Columns.Add(colvarMediaCode);
                
                TableSchema.TableColumn colvarDateAdded = new TableSchema.TableColumn(schema);
                colvarDateAdded.ColumnName = "DateAdded";
                colvarDateAdded.DataType = DbType.DateTime;
                colvarDateAdded.MaxLength = 0;
                colvarDateAdded.AutoIncrement = false;
                colvarDateAdded.IsNullable = false;
                colvarDateAdded.IsPrimaryKey = false;
                colvarDateAdded.IsForeignKey = false;
                colvarDateAdded.IsReadOnly = false;
                
                schema.Columns.Add(colvarDateAdded);
                
                TableSchema.TableColumn colvarDateModified = new TableSchema.TableColumn(schema);
                colvarDateModified.ColumnName = "DateModified";
                colvarDateModified.DataType = DbType.DateTime;
                colvarDateModified.MaxLength = 0;
                colvarDateModified.AutoIncrement = false;
                colvarDateModified.IsNullable = false;
                colvarDateModified.IsPrimaryKey = false;
                colvarDateModified.IsForeignKey = false;
                colvarDateModified.IsReadOnly = false;
                
                schema.Columns.Add(colvarDateModified);
                
                TableSchema.TableColumn colvarBillboardstype = new TableSchema.TableColumn(schema);
                colvarBillboardstype.ColumnName = "Billboardstype";
                colvarBillboardstype.DataType = DbType.String;
                colvarBillboardstype.MaxLength = 4000;
                colvarBillboardstype.AutoIncrement = false;
                colvarBillboardstype.IsNullable = true;
                colvarBillboardstype.IsPrimaryKey = false;
                colvarBillboardstype.IsForeignKey = false;
                colvarBillboardstype.IsReadOnly = false;
                
                schema.Columns.Add(colvarBillboardstype);
                
                TableSchema.TableColumn colvarCarriers = new TableSchema.TableColumn(schema);
                colvarCarriers.ColumnName = "Carriers";
                colvarCarriers.DataType = DbType.String;
                colvarCarriers.MaxLength = 4000;
                colvarCarriers.AutoIncrement = false;
                colvarCarriers.IsNullable = true;
                colvarCarriers.IsPrimaryKey = false;
                colvarCarriers.IsForeignKey = false;
                colvarCarriers.IsReadOnly = false;
                
                schema.Columns.Add(colvarCarriers);
                
                
                BaseSchema = schema;
                //add this schema to the provider
                //so we can query it later
                DataService.Providers["Adex"].AddSchema("vPlanningLog",schema);
            }

        }

        #endregion
        
        #region Query Accessor
	    public static Query CreateQuery()
	    {
		    return new Query(Schema);
	    }

	    #endregion
	    
	    #region .ctors
	    public VPlanningLog()
	    {
            SetSQLProps();
            SetDefaults();
            MarkNew();
        }

        public VPlanningLog(bool useDatabaseDefaults)
	    {
		    SetSQLProps();
		    if(useDatabaseDefaults)
		    {
				ForceDefaults();
			}

			MarkNew();
	    }

	    
	    public VPlanningLog(object keyID)
	    {
		    SetSQLProps();
		    LoadByKey(keyID);
	    }

    	 
	    public VPlanningLog(string columnName, object columnValue)
        {
            SetSQLProps();
            LoadByParam(columnName,columnValue);
        }

        
	    #endregion
	    
	    #region Props
	    
          
        [XmlAttribute("MediaTypeName")]
        public string MediaTypeName 
	    {
		    get
		    {
			    return GetColumnValue<string>("MediaTypeName");
		    }

            set 
		    {
			    SetColumnValue("MediaTypeName", value);
            }

        }

	      
        [XmlAttribute("MediaName")]
        public string MediaName 
	    {
		    get
		    {
			    return GetColumnValue<string>("MediaName");
		    }

            set 
		    {
			    SetColumnValue("MediaName", value);
            }

        }

	      
        [XmlAttribute("MediaType")]
        public int? MediaType 
	    {
		    get
		    {
			    return GetColumnValue<int?>("MediaTypeCode");
		    }

            set 
		    {
			    SetColumnValue("MediaTypeCode", value);
            }

        }

	      
        [XmlAttribute("PlanningLogID")]
        public int PlanningLogID 
	    {
		    get
		    {
			    return GetColumnValue<int>("PlanningLogID");
		    }

            set 
		    {
			    SetColumnValue("PlanningLogID", value);
            }

        }

	      
        [XmlAttribute("MediaCode")]
        public int? MediaCode 
	    {
		    get
		    {
			    return GetColumnValue<int?>("MediaCode");
		    }

            set 
		    {
			    SetColumnValue("MediaCode", value);
            }

        }

	      
        [XmlAttribute("DateAdded")]
        public DateTime DateAdded 
	    {
		    get
		    {
			    return GetColumnValue<DateTime>("DateAdded");
		    }

            set 
		    {
			    SetColumnValue("DateAdded", value);
            }

        }

	      
        [XmlAttribute("DateModified")]
        public DateTime DateModified 
	    {
		    get
		    {
			    return GetColumnValue<DateTime>("DateModified");
		    }

            set 
		    {
			    SetColumnValue("DateModified", value);
            }

        }

	      
        [XmlAttribute("Billboardstype")]
        public string Billboardstype 
	    {
		    get
		    {
			    return GetColumnValue<string>("Billboardstype");
		    }

            set 
		    {
			    SetColumnValue("Billboardstype", value);
            }

        }

	      
        [XmlAttribute("Carriers")]
        public string Carriers 
	    {
		    get
		    {
			    return GetColumnValue<string>("Carriers");
		    }

            set 
		    {
			    SetColumnValue("Carriers", value);
            }

        }

	    
	    #endregion
    
	    #region Columns Struct
	    public struct Columns
	    {
		    
		    
            public static string MediaTypeName = @"MediaTypeName";
            
            public static string MediaName = @"MediaName";
            
            public static string MediaType = @"MediaTypeCode";
            
            public static string PlanningLogID = @"PlanningLogID";
            
            public static string MediaCode = @"MediaCode";
            
            public static string DateAdded = @"DateAdded";
            
            public static string DateModified = @"DateModified";
            
            public static string Billboardstype = @"Billboardstype";
            
            public static string Carriers = @"Carriers";
            
	    }

	    #endregion
    }

}

